package com.etime.perfectschool.service.impl;

import com.etime.perfectschool.mapper.NewsPhotoMapper;
import com.etime.perfectschool.pojo.NewsPhoto;
import com.etime.perfectschool.service.NewsPhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsPhotoServiceImpl implements NewsPhotoService {

    @Autowired
    private NewsPhotoMapper newsPhotoMapper;
  //添加图片
    @Override
    public int insertNewsPhoto(NewsPhoto newsPhoto) {
        return newsPhotoMapper.insert(newsPhoto);
    }
   //查询某条新闻的全部图片
    @Override
    public List<NewsPhoto> getAllNewsPhotoByNewsId(int newsId) {
        return newsPhotoMapper.getAllNewsPhotoByNewsId(newsId);
    }
   //删除某条新闻的全部图片
    @Override
    public boolean deleteNewsPhotoById(int newsId) {
        return newsPhotoMapper.deleteNewsPhotoById(newsId)==0?false:true;
    }
    //修改图片
    @Override
    public boolean updateNewsPhoto(NewsPhoto newsPhoto) {
        return newsPhotoMapper.updateById(newsPhoto)==0?false:true;
    }

}
